package com.snow.datasource.config;

import com.snow.datasource.strategy.LoadBalanceStrategy;
import com.snow.datasource.strategy.RandomStrategy;
import com.snow.datasource.strategy.SnowFlakeStrategy;
import com.snow.datasource.strategy.manage.impl.ManageStrategyImpl;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;

/**
 * @Description
 * @Author fanxl
 * @Date 2020/12/24
 **/
public class StrategyConfig {

    @Bean
    @ConditionalOnMissingBean
    public LoadBalanceStrategy getLoadBalanceStrategy(){
        return new LoadBalanceStrategy();
    }

    @Bean
    @ConditionalOnMissingBean
    public RandomStrategy getRandomStrategy(){
        return new RandomStrategy();
    }

    @Bean
    @ConditionalOnMissingBean
    public SnowFlakeStrategy getSnowFlakeStrategy(){
        return new SnowFlakeStrategy();
    }

    @Bean
    @ConditionalOnMissingBean
    public ManageStrategyImpl getManageStrategyImpl(){
        return new ManageStrategyImpl();
    }
}
